public class PrintS {
    private static Integer count = 0;

    public static void main(String[] args) {
        for(int i=0;i<=20000;i++){
            if(isS(i)){
                System.out.print(i+" ");
                count++;

                if(count % 5 == 0){
                    System.out.println();
                }
            }
        }
    }

    public static Boolean isS(Integer n) {
        if(n<=1){
            return false;
        }

        for(int i=2;i * i <n;i++){
            if(n % i== 0){
                return false;
            }
        }

        return true;
    }
}
